package monitor

import (
	"hxy/repo/model"
	"sync"

	"github.com/google/uuid"
	"github.com/jakecoffman/cron"
)

var managerPool map[uuid.UUID]*GitManager = make(map[uuid.UUID]*GitManager)
var poolmu sync.Mutex

type GitManager struct {
	uid    uuid.UUID
	Repo   model.GitModel
	Job    cron.Cron
	Auth   model.GitAuth
	Status model.GitStatus
}

func (gm GitManager) Conter2Interface() (gi model.GitMonitorInter) {
	gi = model.GitMonitorInter{
		UUID:   gm.uid.String(),
		Name:   gm.Repo.Name,
		Status: gm.Status.Tostring(),
		Gitid:  gm.Repo.ID,
	}
	return
}
